package com.retail.member.controller;

import com.retail.core.entity.result.Result;
import com.retail.member.client.MsgClient;
import com.retail.msg.entity.request.RetailMsgRequest;
import com.retail.msg.entity.vo.RetailMsgVo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(value = "消息页面API", tags = "消息页面API")
@RestController
@RequestMapping("api/msg")
public class MsgApiController {

    @Autowired
    private MsgClient msgClient;

    @PostMapping("findMsgList")
    public Result<List<RetailMsgVo>> findMsgList(@RequestBody RetailMsgRequest request) {
        return msgClient.findMsgList(request);
    }

    @GetMapping("findTop5/{adminId}")
    public Result<List<RetailMsgVo>> findTop5(@PathVariable("adminId") String adminId) {
        return msgClient.findTop5(adminId);
    }

    @GetMapping("/detail/{id}")
    public Result<RetailMsgVo> detail(@PathVariable("id") Long id) {
        return msgClient.detail(id);
    }

    @GetMapping("/updateStatus/{id}/{adminId}")
    public Result<RetailMsgVo> updateStatus(@PathVariable("id") Long id, @PathVariable("adminId") String adminId) {
        return msgClient.updateStatus(id, adminId);
    }
}
